package com.gxzy.domain.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.gxzy.config.FinalPoolCfg;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import java.io.Serializable;
import java.util.Date;

/**
 * 用户信息
 */

@Entity
@Data
@ToString(callSuper = true)
@Builder
@NoArgsConstructor                 //无参构造
@AllArgsConstructor                //有参构造
@Table(name = FinalPoolCfg.TB_USER_NAME)
@org.hibernate.annotations.Table(appliesTo = FinalPoolCfg.TB_USER_NAME, comment = "用户信息")
public class User implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(generator = "snow-flake-id")
    @GenericGenerator(name = "snow-flake-id", strategy = FinalPoolCfg.CFG_GENERIC_GENERATOR_ID_PAG_PATH)
    @Column(columnDefinition = "BIGINT(20) NOT NULL COMMENT '唯一键'")
    private Long id;                                            // 主键

    @Column(columnDefinition = "VARCHAR(255) COMMENT '头像'")
    private String img;                                         // 头像

    @Column(columnDefinition = "VARCHAR(20) COMMENT '姓名'")
    private String name;                                        // 姓名

    @Column(columnDefinition = "BIT DEFAULT 0 COMMENT '性别'")
    private Boolean sex;                                        // 性别

    @Column(columnDefinition = "INT(3) DEFAULT 0 COMMENT '年龄'")
    private Integer age;                                        // 年龄

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Column(columnDefinition = "TIMESTAMP DEFAULT '0000-00-00 00:00:00' COMMENT '出生日期'")
    @Temporal(TemporalType.TIMESTAMP)
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date birth;                                         // 出生日期

    @Column(columnDefinition = "VARCHAR(20) COMMENT '民族'")
    private String nation;                                        // 民族

    @Column(columnDefinition = "VARCHAR(20) COMMENT '教育'")
    private String edu;                                           // 教育，最高学历

    @Column(columnDefinition = "VARCHAR(20) COMMENT '就业状态'")
    private String employmentStatus;                              // 就业状态

    @Column(columnDefinition = "VARCHAR(20) COMMENT '工种，职业'")
    private String work;                                          // 工种，职业

    @Column(columnDefinition = "BIT DEFAULT 0 COMMENT '是否志愿者'")
    private boolean volunteer;                                  // 是否志愿者

    @Column(columnDefinition = "VARCHAR(20) COMMENT '籍贯'")
    private String nativePlace;                                   // 籍贯

    @Column(columnDefinition = "VARCHAR(20) COMMENT '国家'")
    private String country;                                       // 国家

    @Column(columnDefinition = "VARCHAR(20) COMMENT '省-自治区-直辖市'")
    private String province;                                      // 省-自治区-直辖市

    @Column(columnDefinition = "VARCHAR(20) COMMENT '地级市-地区-自治州-盟'")
    private String city;                                          // 地级市-地区-自治州-盟

    @Column(columnDefinition = "VARCHAR(20) COMMENT '市辖区-县级市-县'")
    private String county;                                        // 市辖区-县级市-县

    @Column(columnDefinition = "BIGINT(20) COMMENT '街道办-乡'")
    private Long street;                                        // 街道办-乡

    @Column(columnDefinition = "BIGINT(20) COMMENT '社区'")
    private Long community;                                     // 社区

    @Column(columnDefinition = "BIGINT(20) COMMENT '小区'")
    private Long village;                                       // 小区

    @Column(columnDefinition = "VARCHAR(255) COMMENT '详细地址'")
    private String address;                                     // 详细地址

    @Column(columnDefinition = "VARCHAR(20) COMMENT '政治面貌'")
    private String politicalAffiliation;                          // 政治面貌

    @Column(columnDefinition = "VARCHAR(20) COMMENT '现居城市'")
    private String nowCity;                                       // 现居城市

    @Column(columnDefinition = "VARCHAR(50) COMMENT '固定号码'")
    private String number;                                      // 固定号码

    @Column(columnDefinition = "VARCHAR(50) COMMENT '邮政编码'")
    private String postcodes;                                   // 邮政编码

    @Column(columnDefinition = "VARCHAR(50) COMMENT 'qq'")
    private String qq;                                          // qq

    @Column(columnDefinition = "VARCHAR(50) COMMENT '微博'")
    private String microblog;                                   // 微博
}
